A-Tune 用户指南
1 认识 A-Tune
1.1 简介
操作系统作为衔接应用和硬件的基础软件,如何调整系统和应用配置,充分发挥软硬件能力,从而使业务性能达到最优,对用户至关重要。然而,运行在操作系统上的业务类型成百上千,应用形态千差万别,对资源的要求各不相同。当前硬件和基础软件组成的应用环境涉及高达 7000 多个配置对象,随着业务复杂度和调优对象的增加,调优所需的时间成本呈指数级增长,导致调优效率急剧下降,调优成为了一项极其复杂的工程,给用户带来巨大挑战。
其次,操作系统作为基础设施软件,提供了大量的软硬件管理能力,每种能力适用场景不尽相同,并非对所有的应用场景都通用有益,因此,不同的场景需要开启或关闭不同的能力,组合使用系统提供的各种能力,才能发挥应用程序的最佳性能。
另外,实际业务场景成千上万,计算、网络、存储等硬件配置也层出不穷,实验室无法遍历穷举所有的应用和业务场景,以及不同的硬件组合。
为了应对上述挑战,openEuler 推出了 A-Tune 。
A-Tune 是一款基于AI 开发的系统性能优化引擎,它利用人工智能技术,对业务场景建立精准的系统画像,感知并推理出业务特征,进而做出智能决策,匹配并推荐最佳的系统参数配置组合,使业务处于最佳运行状态。
1.2 业务模型
根据应用的负载特征,A-Tune 将业务分为七大类,各类型的负载特征和 A-Tune 支持的应用请参见表 1-2 。
表 1-2 支持的业务类型和应用
负载模型 | 业务类型 | 负载特征 | 支持的应用 |
---|---|---|---|
default | 默认类型 | CPU、内存带宽、网络、IO 各维度资源使用率都不高 | N/A |
webserver | https 应用 | CPU 使用率高 | Nginx |
big_database | 数据库 | - 关系型数据库 读: CPU、内存带宽、网络使用率高 写:IO 使用率高 - 非关系型数据库 CPU、IO 使用率高 |
MongoDB、MySQL、PostgreSQL、MariaDB |
big_data | 大数据 | CPU、IO 使用率较高 | Hadoop、Spark |
in-memory_computing | 内存密集型应用 | CPU、内存带宽使用率高 | SPECjbb2015 |
in-memory_database | 计算+网络密集型应用 | CPU 单核使用率高,多实例下网络使用率高 | Redis |
single_computer_intensive_jobs | 计算密集型应用 | CPU 单核使用率高,部分子项内存带宽使用率高 | SPECCPU2006 |
communication | 网络密集型应用 | CPU、网络使用率高 | Dubbo |
idle | 系统idle | 系统处于空闲状态,无任何应用运行 | N/A |
2 安装与部署
2.1 安装 A-Tune
2.1.1 安装模式介绍
A-Tune 支持单机模式和分布式模式安装:
单机模式
client 和 server 安装到同一台机器上。
分布式模式
client 和 server 分别安装在不同的机器上。
两种安装模式的简单图示如下:
2.1.2 安装操作
步骤 1 安装 A-Tune 服务端。
本步骤会同时安装服务端和客户端软件包,对于单机部署模式,请跳过步骤 2。
# dnf install atune -y
步骤 2 若为分布式部署,请在相关服务器上安装 A-Tune 客户端。
# dnf install atune-client -y
步骤 3 验证是否安装成功。
# rpm -qa | grep atune
atune-client-xxx
atune-db-xxx
atune-xxx
有如上回显信息表示安装成功。
2.2 部署 A-Tune
本章介绍 A-Tune 的配置部署。
2.2.1 配置介绍
A-Tune 配置文件 /etc/atuned/atuned.cnf
的配置项说明如下:
A-Tune 服务启动配置
可根据需要进行修改。
- protocol:系统 grpc 服务使用的协议,unix 或 tcp ,unix 为本地 socket 通信方式,tcp 为 socket 监听端口方式。默认为 unix。
- address:系统 grpc 服务的侦听地址,默认为 unix socket,若为分布式部署,需修改为侦听的 ip 地址。
- port:系统 grpc 服务的侦听端口,范围为 0 ~ 65535 未使用的端口。如果 protocol 配置是 unix,则不需要配置。
- rest_port:系统 restservice 的侦听端口, 范围为 0 ~ 65535 未使用的端口。
- sample_num:系统执行 analysis 流程时采集样本的数量。
system 信息
system 为系统执行相关的优化需要用到的参数信息,必须根据系统实际情况进行修改。
disk:执行 analysis 流程时需要采集的对应磁盘的信息或执行磁盘相关优化时需要指定的磁盘。
network:执行 analysis 时需要采集的对应的网卡的信息或执行网卡相关优化时需要指定的网卡。
user:执行
ulimit
相关优化时用到的用户名。目前只支持 root 用户。tls:开启 A-Tune 的 gRPC 和 http 服务 SSL/TLS 证书校验,默认不开启。开启 TLS 后
atune-adm
命令在使用前需要设置以下环境变量方可与服务端进行通讯:export ATUNE_TLS=yes
export ATUNE_CLICERT=<客户端证书路径>
tlsservercertfile:gPRC 服务端证书路径。
tlsserverkeyfile:gPRC 服务端秘钥路径。
tlshttpcertfile:http 服务端证书路径。
tlshttpkeyfile:http 服务端秘钥路径。
tlshttpcacertfile:http 服务端 CA 证书路径。
日志信息
根据情况修改日志的路径和级别,默认的日志信息在/var/log/messages
中。
monitor 信息
为系统启动时默认采集的系统硬件信息。
配置示例
#################################### server ###############################
# atuned config
[server]
# the protocol grpc server running on
# ranges: unix or tcp
protocol = unix
# the address that the grpc server to bind to
# default is unix socket /var/run/atuned/atuned.sock
# ranges: /var/run/atuned/atuned.sock or ip
address = /var/run/atuned/atuned.sock
# the atuned grpc listening port, default is 60001
# the port can be set between 0 to 65535 which not be used
port = 60001
# the rest service listening port, default is 8383
# the port can be set between 0 to 65535 which not be used
rest_port = 8383
# when run analysis command, the numbers of collected data.
# default is 20
sample_num = 20
# Enable gRPC and http server authentication SSL/TLS
# default is false
# tls = true
# tlsservercertfile = /etc/atuned/server.pem
# tlsserverkeyfile = /etc/atuned/server.key
# tlshttpcertfile = /etc/atuned/http/server.pem
# tlshttpkeyfile = /etc/atuned/http/server.key
# tlshttpcacertfile = /etc/atuned/http/cacert.pem
#################################### log ###############################
# Either "debug", "info", "warn", "error", "critical", default is "info"
level = info
#################################### monitor ###############################
[monitor]
# With the module and format of the MPI, the format is {module}_{purpose}
# The module is Either "mem", "net", "cpu", "storage"
# The purpose is "topo"
module = mem_topo, cpu_topo
#################################### system ###############################
# you can add arbitrary key-value here, just like key = value
# you can use the key in the profile
[system]
# the disk to be analysis
disk = sda
# the network to be analysis
network = enp189s0f0
user = root
2.2.2 启动 A-Tune
A-Tune 安装完成后,需要启动 A-Tune 服务才能使用。
启动 atuned 服务:
# systemctl start atuned
查询 atuned 服务状态:
# systemctl status atuned
若回显为如下,则服务启动成功。